<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
use think\Request;
class Examine extends Base{

    //会员的个人上传视频，文章列表
    public function userlist(){
        $row = Db::table("users")->where("user_id > 0")->paginate(8);
        $name = "";
        $page = $row->render();
        $this->view->assign("row",$row);
        $this->view->assign("row",$row);
        $this->view->assign("name",$name);
        $this->assign('page', $page);
        return view();
    }

    //会员视频
    public function uservideo(){
        $request = Request::instance()->get();
        $id = $request['id'];
        $row = Db::table("courses")->where("user_id = $id")->select();
        $this->assign("row",$row);
        return view();
    }

    //改变状态
    public function isEae(){
        $request = Request::instance()->get();
        $id = $request['id'];
        $code = $request['code'];
        if($code == ""){
            return false;
        }
        if($code ==1){
            //退回
           Db::table("courses")->where('courses_id', $id)->update(['courses_del' => 1]);
            echo 1;
        }elseif($code == 2){
            //通过
            Db::table("courses")->where('courses_id', $id)->update(['courses_del' => 0]);
            echo 1;
        }else{
            echo  556;
        }
    }


    //未审核视频列表
    public function videolist(){
        $row = Db::table('courses')
            ->where("courses_del = 2")
            ->alias('co')
            ->join('users u','co.user_id = u.user_id')
            ->order('courses_id asc')
            ->select();
        $this->assign('courses',$row);
        return view();
    }

    public function videos(){
        $request = Request::instance()->get();
        $id = $request['id'];
        $row = Db::table("courses")->where("courses_id = $id")->find();
        $this->assign("details",$row);
        return view();
        
    }









}